<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>页面加载事件</title>
    <!-- <script>
        var ele = document.getElementById("one");
        console.log(ele);  // null，因为这时候页面还没加载完
    </script> -->
    <script>
        window.onload = function () {
            var ele = document.getElementById("one");
            console.log(ele);
            console.log("页面加载完毕");
        }
    </script>
    </body>
</head>

<body>
    <div id="one">内容</div>

</html>